local lspconfig = require("lspconfig")

lspconfig.volar.setup({
    on_attach = function(client, bufnr)
        local builtin = require("telescope.builtin") -- ✅ 确保这一句存在

        local opts = {
            buffer = bufnr,
            noremap = true,
            silent = true
        }
        vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
        vim.keymap.set("n", "gd", builtin.lsp_definitions, opts)
        vim.keymap.set("n", "gi", builtin.lsp_implementations, opts)
        vim.keymap.set("n", "gt", builtin.lsp_type_definitions, opts)

        vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, opts)
        vim.keymap.set("v", "<leader>ca", vim.lsp.buf.code_action, opts)
    end,
    capabilities = require("cmp_nvim_lsp").default_capabilities(),
    filetypes = {"vue", "typescript", "javascript"}
})
